<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <div onclick=fn></div> -->
    <div class="a" onclick="fn()"></div>

    <script>

        document.onclick = function () { }


        // fn是将来点击了以后才会被调用的  
        document.onclick = fn;


        function fn() {
            console.log(666);
        }

        // 写函数的写法更好一些
        // setInterval(fn, 1000)

        // setInterval("fn()", 1000)

    </script>

</body>

</html>